package com.fowo.api.inventory.model.form;

import com.fowo.api.inventory.model.InventoryExchangeVo;
import com.fowo.api.inventory.model.PatternEnum;
import com.fowo.api.inventory.model.TargetTypeEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * 整单库存内流转参数模型
 * @author yl_ls
 */
@Getter
@Setter
@Accessors(chain = true)
public class InventoryExchangeFormVo extends InventoryStorageBaseVo {

    @Schema(title = "出库仓库内码")
    private Long fromStockId;

    @Schema(title = "入库仓库内码")
    private Long toStockId;

    @Schema(title = "流转源类型\n" +
            "    - Normal : 正常库存\n" +
            "    - Lock: 锁定库存\n" +
            "    - Display: 展示库存\n" +
            "    - Defect: 残次库存\n" +
            "    - Way: 在途库存")
    private TargetTypeEnum from;
    @Schema(title = "流转目标类型\n" +
            "    - Normal : 正常库存\n" +
            "    - Lock: 锁定库存\n" +
            "    - Display: 展示库存\n" +
            "    - Defect: 残次库存\n" +
            "    - Way: 在途库存")
    private TargetTypeEnum to;
    @Schema(title = "选择模式\n" +
            "    - LIFO: 后进先出\n" +
            "    - FIFO: 先进先出\n" +
            "    - ExpiryEarlier: 近有效期先出\"不新鲜\"\n" +
            "    - ExpiryLater: 远有效期先出\"新鲜\"" )
    private PatternEnum model;



    /**
     * 流转项
     */
    @Schema(title = "流转项")
    private List<InventoryExchangeVo> items;

    /**
     * 添加流转项
     * @param item 流转项
     * @return 自身
     */
    public InventoryExchangeFormVo add(InventoryExchangeVo item) {
        if (items == null) {
            items = new ArrayList<>();
        }
        items.add(item);
        return this;
    }
}
